package com.westcom.vulb.activity;

import android.app.Activity;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Window;
import android.widget.Toast;

import com.westcom.vulb.protocal.http.Response;

public class BasicActivity extends Activity {
    public static final int HTTP_RESPONSE_STATUS = 110;
    
    protected Handler mHttpResponseHandler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message msg) 
        {
            if (msg.what == HTTP_RESPONSE_STATUS) 
            {
                switch (msg.arg1) 
                {
                    case Response.SESSION_ERROR:
                        //TODO alert login again and go to login page.
                        break;
                    case Response.SYSTEM_MAINTANANCE:
                        //TODO alert, and exit application
                        break;
                }
            }
            
            return false;
        }
    });
    
    protected ProgressDialog mLoadingDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        mLoadingDialog = new ProgressDialog(this);
        super.onCreate(savedInstanceState);
    }
    protected void launchToast(String str)
    {
		Toast toast = Toast.makeText(this,str, 10);
		toast.show();
    }
    protected void launchToast(int res)
    {
		Toast toast = Toast.makeText(this,this.getResources().getString(res), 10);
		toast.show();
    }
    
    public class userNode
	{
		public String mName = null;
		public int mId = -1;
		public Bitmap mImg = null;
		public boolean mIsClicked = false;
		public String mStatus = null;//memberStatus 0:normal,1:invited but not accepted,null:owner
		public String mOwnFlg = null;//ownFlg
		public int mIndex_in_real_array = 0;;
		public userNode(String name,int id)
		{
			mName = name;
			mId = id;
		}
	}
}
